﻿@model PagedResult<playing_dto>
@{ var imgUrl = ViewBag.img_url;
    long userID = ViewBag.user_id;
    int type = ViewBag.type;}
@{

    if (Model.rows.Count > 0) {
        foreach (var row in Model.rows) {
            DateTime dt = DateTime.Now;
            var guess_playing = row.user_Guess_Playing_Hiss;
            <div class="guess_task">
                <div class="guess_center">
                    <div class="lf play" data-id="@row.home_team_id" data-playid="@row.id">
                        <img src="@(imgUrl + row.home_team.img_url)" alt="" class="flag">
                        <span class="state">@row.home_team.title</span>
                        @{int hnum = userID > 0 ? guess_playing.Where(s => s.playing_id == row.id && s.guess_team_id == row.home_team_id && s.user_id == userID).Select(s => s.guess_num).DefaultIfEmpty(0).Sum() : 0;
                            int thnum = guess_playing.Where(s => s.playing_id == row.id && s.guess_team_id == row.home_team_id).Select(s => s.guess_num).DefaultIfEmpty(0).Sum();}
                        <span class="digit @(row.win_team_id!=null?"hui":hnum > 0 ? "win" : "tie") @(row.participation_end_time<=dt?"playend hui":"") " id="p@(row.id.ToString() + row.home_team_id.ToString())" data-num="@hnum" data-tnum="@thnum">胜(@(hnum))</span>
                        <span class="number">总参与数(@thnum)</span>
                    </div>
                    <div class="ct play" data-id="0" data-playid="@row.id">
                        <p class="title">@row.play_type_title</p>
                        <time class="time">@row.play_time.ToString("MM月dd日  HH:mm")</time>
                        <div class="draw_ct">
                            @{ int pnum = userID > 0 ? guess_playing.Where(s => s.playing_id == row.id && s.guess_team_id == 0 && s.user_id == userID).Select(s => s.guess_num).DefaultIfEmpty(0).Sum() : 0;
                                int tpnum = guess_playing.Where(s => s.playing_id == row.id && s.guess_team_id == 0).Select(s => s.guess_num).DefaultIfEmpty(0).Sum();}
                            <span class="digit @(row.win_team_id!=null?"hui":pnum > 0 ? "win" : "tie") @(row.play_type!=EPlayType.GroupCompetition?"hui":"")  @(row.participation_end_time<=dt?"playend":"") " id="p@(row.id.ToString() + 0)" data-num="@pnum" data-tnum="@tpnum">平局(@(pnum))</span>
                            <span class="number">总参与数(@tpnum)</span>
                        </div>
                    </div>
                    <div class="rg play" data-id="@row.guest_team_id" data-playid="@row.id">
                        <img src="@(imgUrl + row.guest_team.img_url)" alt="" class="flag">
                        <span class="state">@row.guest_team.title</span>
                        @{int gnum = userID > 0 ? guess_playing.Where(s => s.playing_id == row.id && s.guess_team_id == row.guest_team_id && s.user_id == userID).Select(s => s.guess_num).DefaultIfEmpty(0).Sum() : 0;
                            int tgnum = guess_playing.Where(s => s.playing_id == row.id && s.guess_team_id == row.guest_team_id).Select(s => s.guess_num).DefaultIfEmpty(0).Sum();}
                        <span class="digit @(row.win_team_id !=null?"hui":gnum > 0 ? "win" : "tie")  @(row.participation_end_time<=dt?"playend":"") " id="p@(row.id.ToString()+row.guest_team_id)" data-num="@gnum" data-tnum="@tgnum">胜(@(gnum))</span>
                        <span class="number">总参与数(@tgnum)</span>
                    </div>
                </div>
                <p class="cutoff">@row.participation_end_time.ToString("MM月dd日  HH:mm") 截止参与</p>
            </div>
        }
    }
    <page  id="page_@type" rows="@Model.rows.Count()" total_result="@Model.total_result"></page>
}
